<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>class Net::SMTP - net-smtp: Ruby Standard Library Documentation</title>


<script src="../js/navigation.js" defer></script>
<script src="../js/search.js" defer></script>
<script src="../js/search_index.js" defer></script>
<script src="../js/searcher.js" defer></script>
<script src="../js/darkfish.js" defer></script>

<script src="../js/jquery-3.2.0.min.js"></script>

<script src="../js/vue.min.js"></script>
<script src="../js/js.cookie.min.js"></script>

<link href="../css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="../css/rdoc.css" rel="stylesheet">
<link href="../css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "../";
  var index_rel_prefix = "../";
  var darkModeCsseHref = "../css/rdoc-dm.css"
  var defaultModeCssHref = "../css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="class">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0.preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="../index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="../table_of_contents.html#pages">Pages</a>
    <a href="../table_of_contents.html#classes">Classes</a>
    <a href="../table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    
<div class="nav-section">
  <h3>Table of Contents</h3>

  <ul class="link-list" role="directory">
    <li><a href="#class-Net::SMTP-label-What+is+This+Library-3F">What is This Library?</a>
    <li><a href="#class-Net::SMTP-label-What+is+This+Library+NOT-3F">What is This Library NOT?</a>
    <li><a href="#class-Net::SMTP-label-Examples">Examples</a>
    <li><a href="#class-Net::SMTP-label-Sending+Messages">Sending Messages</a>
    <li><a href="#class-Net::SMTP-label-Closing+the+Session">Closing the Session</a>
    <li><a href="#class-Net::SMTP-label-HELO+domain">HELO domain</a>
    <li><a href="#class-Net::SMTP-label-SMTP+Authentication">SMTP Authentication</a>
  </ul>
</div>


    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
<div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  <p class="link">Protocol
</div>

        
        
        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li ><a href="#method-c-default_port">::default_port</a>
    <li ><a href="#method-c-default_ssl_context">::default_ssl_context</a>
    <li ><a href="#method-c-default_ssl_port">::default_ssl_port</a>
    <li ><a href="#method-c-default_submission_port">::default_submission_port</a>
    <li ><a href="#method-c-default_tls_port">::default_tls_port</a>
    <li ><a href="#method-c-new">::new</a>
    <li ><a href="#method-c-start">::start</a>
    <li ><a href="#method-i-auth_capable-3F">#auth_capable?</a>
    <li ><a href="#method-i-auth_cram_md5">#auth_cram_md5</a>
    <li ><a href="#method-i-auth_login">#auth_login</a>
    <li ><a href="#method-i-auth_method">#auth_method</a>
    <li ><a href="#method-i-auth_plain">#auth_plain</a>
    <li ><a href="#method-i-authenticate">#authenticate</a>
    <li ><a href="#method-i-base64_encode">#base64_encode</a>
    <li ><a href="#method-i-capable-3F">#capable?</a>
    <li ><a href="#method-i-capable_auth_types">#capable_auth_types</a>
    <li ><a href="#method-i-capable_cram_md5_auth-3F">#capable_cram_md5_auth?</a>
    <li ><a href="#method-i-capable_login_auth-3F">#capable_login_auth?</a>
    <li ><a href="#method-i-capable_plain_auth-3F">#capable_plain_auth?</a>
    <li ><a href="#method-i-capable_starttls-3F">#capable_starttls?</a>
    <li ><a href="#method-i-check_auth_args">#check_auth_args</a>
    <li ><a href="#method-i-check_auth_continue">#check_auth_continue</a>
    <li ><a href="#method-i-check_auth_method">#check_auth_method</a>
    <li ><a href="#method-i-check_auth_response">#check_auth_response</a>
    <li ><a href="#method-i-check_continue">#check_continue</a>
    <li ><a href="#method-i-check_response">#check_response</a>
    <li ><a href="#method-i-cram_md5_response">#cram_md5_response</a>
    <li ><a href="#method-i-cram_secret">#cram_secret</a>
    <li ><a href="#method-i-critical">#critical</a>
    <li ><a href="#method-i-data">#data</a>
    <li ><a href="#method-i-debug_output-3D">#debug_output=</a>
    <li ><a href="#method-i-digest_class">#digest_class</a>
    <li ><a href="#method-i-disable_ssl">#disable_ssl</a>
    <li ><a href="#method-i-disable_starttls">#disable_starttls</a>
    <li ><a href="#method-i-disable_tls">#disable_tls</a>
    <li ><a href="#method-i-do_finish">#do_finish</a>
    <li ><a href="#method-i-do_helo">#do_helo</a>
    <li ><a href="#method-i-do_start">#do_start</a>
    <li ><a href="#method-i-ehlo">#ehlo</a>
    <li ><a href="#method-i-enable_ssl">#enable_ssl</a>
    <li ><a href="#method-i-enable_starttls">#enable_starttls</a>
    <li ><a href="#method-i-enable_starttls_auto">#enable_starttls_auto</a>
    <li ><a href="#method-i-enable_tls">#enable_tls</a>
    <li ><a href="#method-i-finish">#finish</a>
    <li ><a href="#method-i-get_response">#get_response</a>
    <li ><a href="#method-i-getok">#getok</a>
    <li ><a href="#method-i-helo">#helo</a>
    <li ><a href="#method-i-inspect">#inspect</a>
    <li ><a href="#method-i-logging">#logging</a>
    <li ><a href="#method-i-mailfrom">#mailfrom</a>
    <li ><a href="#method-i-new_internet_message_io">#new_internet_message_io</a>
    <li ><a href="#method-i-open_message_stream">#open_message_stream</a>
    <li ><a href="#method-i-quit">#quit</a>
    <li ><a href="#method-i-rcptto">#rcptto</a>
    <li ><a href="#method-i-rcptto_list">#rcptto_list</a>
    <li ><a href="#method-i-read_timeout-3D">#read_timeout=</a>
    <li ><a href="#method-i-ready">#ready</a>
    <li ><a href="#method-i-recv_response">#recv_response</a>
    <li ><a href="#method-i-rset">#rset</a>
    <li ><a href="#method-i-send_mail">#send_mail</a>
    <li ><a href="#method-i-send_message">#send_message</a>
    <li ><a href="#method-i-sendmail">#sendmail</a>
    <li ><a href="#method-i-set_debug_output">#set_debug_output</a>
    <li ><a href="#method-i-ssl-3F">#ssl?</a>
    <li ><a href="#method-i-ssl_socket">#ssl_socket</a>
    <li ><a href="#method-i-start">#start</a>
    <li ><a href="#method-i-started-3F">#started?</a>
    <li ><a href="#method-i-starttls">#starttls</a>
    <li ><a href="#method-i-starttls-3F">#starttls?</a>
    <li ><a href="#method-i-starttls_always-3F">#starttls_always?</a>
    <li ><a href="#method-i-starttls_auto-3F">#starttls_auto?</a>
    <li ><a href="#method-i-tcp_socket">#tcp_socket</a>
    <li ><a href="#method-i-tls-3F">#tls?</a>
    <li ><a href="#method-i-tlsconnect">#tlsconnect</a>
    <li ><a href="#method-i-validate_line">#validate_line</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="class-Net::SMTP">
    <h1 id="class-Net::SMTP" class="class">
      class Net::SMTP
    </h1>

    <section class="description">
    
<h2 id="class-Net::SMTP-label-What+is+This+Library-3F">What is This Library?<span><a href="#class-Net::SMTP-label-What+is+This+Library-3F">&para;</a> <a href="#top">&uarr;</a></span></h2>

<p>This library provides functionality to send internet mail via <a href="SMTP.html"><code>SMTP</code></a>, the Simple Mail Transfer Protocol. For details of <a href="SMTP.html"><code>SMTP</code></a> itself, see [RFC2821] (<a href="http://www.ietf.org/rfc/rfc2821.txt">www.ietf.org/rfc/rfc2821.txt</a>).</p>

<h2 id="class-Net::SMTP-label-What+is+This+Library+NOT-3F">What is This Library NOT?<span><a href="#class-Net::SMTP-label-What+is+This+Library+NOT-3F">&para;</a> <a href="#top">&uarr;</a></span></h2>

<p>This library does NOT provide functions to compose internet mails. You must create them by yourself. If you want better mail support, try RubyMail or TMail or search for alternatives in <a href="https://rubygems.org/">RubyGems.org</a> or <a href="https://www.ruby-toolbox.com/">The Ruby Toolbox</a>.</p>

<p>FYI: the official documentation on internet mail is: [RFC2822] (<a href="http://www.ietf.org/rfc/rfc2822.txt">www.ietf.org/rfc/rfc2822.txt</a>).</p>

<h2 id="class-Net::SMTP-label-Examples">Examples<span><a href="#class-Net::SMTP-label-Examples">&para;</a> <a href="#top">&uarr;</a></span></h2>

<h3 id="class-Net::SMTP-label-Sending+Messages">Sending Messages<span><a href="#class-Net::SMTP-label-Sending+Messages">&para;</a> <a href="#top">&uarr;</a></span></h3>

<p>You must open a connection to an <a href="SMTP.html"><code>SMTP</code></a> server before sending messages. The first argument is the address of your <a href="SMTP.html"><code>SMTP</code></a> server, and the second argument is the port number. Using <a href="SMTP.html#method-c-start"><code>SMTP.start</code></a> with a block is the simplest way to do this. This way, the <a href="SMTP.html"><code>SMTP</code></a> connection is closed automatically after the block is executed.</p>

<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">&#39;net/smtp&#39;</span>
<span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">SMTP</span>.<span class="ruby-identifier">start</span>(<span class="ruby-string">&#39;your.smtp.server&#39;</span>, <span class="ruby-value">25</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">smtp</span><span class="ruby-operator">|</span>
  <span class="ruby-comment"># Use the SMTP object smtp only in this block.</span>
<span class="ruby-keyword">end</span>
</pre>

<p>Replace ‘your.smtp.server’ with your <a href="SMTP.html"><code>SMTP</code></a> server. Normally your system manager or internet provider supplies a server for you.</p>

<p>Then you can send messages.</p>

<pre class="ruby"><span class="ruby-identifier">msgstr</span> = <span class="ruby-identifier">&lt;&lt;END_OF_MESSAGE</span>
<span class="ruby-value">From: Your Name &lt;your@mail.address&gt;
To: Destination Address &lt;someone@example.com&gt;
Subject: test message
Date: Sat, 23 Jun 2001 16:26:43 +0900
Message-Id: &lt;unique.message.id.string@example.com&gt;

This is a test message.
</span><span class="ruby-identifier">END_OF_MESSAGE</span>

<span class="ruby-identifier">require</span> <span class="ruby-string">&#39;net/smtp&#39;</span>
<span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">SMTP</span>.<span class="ruby-identifier">start</span>(<span class="ruby-string">&#39;your.smtp.server&#39;</span>, <span class="ruby-value">25</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">smtp</span><span class="ruby-operator">|</span>
  <span class="ruby-identifier">smtp</span>.<span class="ruby-identifier">send_message</span> <span class="ruby-identifier">msgstr</span>,
                    <span class="ruby-string">&#39;your@mail.address&#39;</span>,
                    <span class="ruby-string">&#39;his_address@example.com&#39;</span>
<span class="ruby-keyword">end</span>
</pre>

<h3 id="class-Net::SMTP-label-Closing+the+Session">Closing the Session<span><a href="#class-Net::SMTP-label-Closing+the+Session">&para;</a> <a href="#top">&uarr;</a></span></h3>

<p>You MUST close the <a href="SMTP.html"><code>SMTP</code></a> session after sending messages, by calling the <a href="SMTP.html#method-i-finish"><code>finish</code></a> method:</p>

<pre class="ruby"><span class="ruby-comment"># using SMTP#finish</span>
<span class="ruby-identifier">smtp</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">SMTP</span>.<span class="ruby-identifier">start</span>(<span class="ruby-string">&#39;your.smtp.server&#39;</span>, <span class="ruby-value">25</span>)
<span class="ruby-identifier">smtp</span>.<span class="ruby-identifier">send_message</span> <span class="ruby-identifier">msgstr</span>, <span class="ruby-string">&#39;from@address&#39;</span>, <span class="ruby-string">&#39;to@address&#39;</span>
<span class="ruby-identifier">smtp</span>.<span class="ruby-identifier">finish</span>
</pre>

<p>You can also use the block form of <a href="SMTP.html#method-c-start"><code>SMTP.start</code></a>/SMTP#start.  This closes the <a href="SMTP.html"><code>SMTP</code></a> session automatically:</p>

<pre class="ruby"><span class="ruby-comment"># using block form of SMTP.start</span>
<span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">SMTP</span>.<span class="ruby-identifier">start</span>(<span class="ruby-string">&#39;your.smtp.server&#39;</span>, <span class="ruby-value">25</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">smtp</span><span class="ruby-operator">|</span>
  <span class="ruby-identifier">smtp</span>.<span class="ruby-identifier">send_message</span> <span class="ruby-identifier">msgstr</span>, <span class="ruby-string">&#39;from@address&#39;</span>, <span class="ruby-string">&#39;to@address&#39;</span>
<span class="ruby-keyword">end</span>
</pre>

<p>I strongly recommend this scheme.  This form is simpler and more robust.</p>

<h3 id="class-Net::SMTP-label-HELO+domain">HELO domain<span><a href="#class-Net::SMTP-label-HELO+domain">&para;</a> <a href="#top">&uarr;</a></span></h3>

<p>In almost all situations, you must provide a third argument to <a href="SMTP.html#method-c-start"><code>SMTP.start</code></a>/SMTP#start. This is the domain name which you are on (the host to send mail from). It is called the “HELO domain”. The <a href="SMTP.html"><code>SMTP</code></a> server will judge whether it should send or reject the <a href="SMTP.html"><code>SMTP</code></a> session by inspecting the HELO domain.</p>

<pre>Net::SMTP.start(&#39;your.smtp.server&#39;, 25
                helo: &#39;mail.from.domain&#39;) { |smtp| ... }</pre>

<h3 id="class-Net::SMTP-label-SMTP+Authentication"><a href="SMTP.html"><code>SMTP</code></a> Authentication<span><a href="#class-Net::SMTP-label-SMTP+Authentication">&para;</a> <a href="#top">&uarr;</a></span></h3>

<p>The <a href="SMTP.html"><code>Net::SMTP</code></a> class supports three authentication schemes; PLAIN, LOGIN and CRAM MD5.  (<a href="SMTP.html"><code>SMTP</code></a> Authentication: [RFC2554]) To use <a href="SMTP.html"><code>SMTP</code></a> authentication, pass extra arguments to <a href="SMTP.html#method-c-start"><code>SMTP.start</code></a>/SMTP#start.</p>

<pre># PLAIN
Net::SMTP.start(&#39;your.smtp.server&#39;, 25
                user: &#39;Your Account&#39;, secret: &#39;Your Password&#39;, authtype: :plain)
# LOGIN
Net::SMTP.start(&#39;your.smtp.server&#39;, 25
                user: &#39;Your Account&#39;, secret: &#39;Your Password&#39;, authtype: :login)

# CRAM MD5
Net::SMTP.start(&#39;your.smtp.server&#39;, 25
                user: &#39;Your Account&#39;, secret: &#39;Your Password&#39;, authtype: :cram_md5)</pre>

    </section>

      <section id="5Buntitled-5D" class="documentation-section">


      <section class="constants-list">
      <header>
      <h3>Constants</h3>
      </header>
      <dl>
          <dt id="CRAM_BUFSIZE">CRAM_BUFSIZE
          <dd>
          <dt id="DEFAULT_AUTH_TYPE">DEFAULT_AUTH_TYPE
          <dd><p>Authentication</p>
          <dt id="IMASK">IMASK
          <dd>
          <dt id="OMASK">OMASK
          <dd>
          <dt id="Revision">Revision
          <dd>
          <dt id="VERSION">VERSION
          <dd>
        </dl>
        </section>

        <section class="attribute-method-details" class="method-section">
        <header>
        <h3>Attributes</h3>
        </header>

          <div id="attribute-i-address" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">address</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p>The address of the <a href="SMTP.html"><code>SMTP</code></a> server to connect to.</p>
              </div>
            </div>
          <div id="attribute-i-capabilities" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">capabilities</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p>The server capabilities by EHLO response</p>
              </div>
            </div>
          <div id="attribute-i-esmtp" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">esmtp</span><span
                class="attribute-access-type">[RW]</span>
            </div>

            <div class="method-description">
              <p>Set whether to use ESMTP or not.  This should be done before calling <a href="SMTP.html#method-i-start"><code>start</code></a>.  Note that if <a href="SMTP.html#method-i-start"><code>start</code></a> is called in ESMTP mode, and the connection fails due to a ProtocolError, the <a href="SMTP.html"><code>SMTP</code></a> object will automatically switch to plain <a href="SMTP.html"><code>SMTP</code></a> mode and retry (but not vice versa).</p>
              </div>
            </div>
          <div id="attribute-i-esmtp-3F" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">esmtp?</span><span
                class="attribute-access-type">[RW]</span>
            </div>

            <div class="method-description">
              <p>Set whether to use ESMTP or not.  This should be done before calling <a href="SMTP.html#method-i-start"><code>start</code></a>.  Note that if <a href="SMTP.html#method-i-start"><code>start</code></a> is called in ESMTP mode, and the connection fails due to a ProtocolError, the <a href="SMTP.html"><code>SMTP</code></a> object will automatically switch to plain <a href="SMTP.html"><code>SMTP</code></a> mode and retry (but not vice versa).</p>
              </div>
            </div>
          <div id="attribute-i-open_timeout" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">open_timeout</span><span
                class="attribute-access-type">[RW]</span>
            </div>

            <div class="method-description">
              <p>Seconds to wait while attempting to open a connection. If the connection cannot be opened within this time, a Net::OpenTimeout is raised. The default value is 30 seconds.</p>
              </div>
            </div>
          <div id="attribute-i-port" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">port</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p>The port number of the <a href="SMTP.html"><code>SMTP</code></a> server to connect to.</p>
              </div>
            </div>
          <div id="attribute-i-read_timeout" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">read_timeout</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p>Seconds to wait while reading one block (by one read(2) call). If the read(2) call does not complete within this time, a Net::ReadTimeout is raised. The default value is 60 seconds.</p>
              </div>
            </div>
          <div id="attribute-i-ssl_context_params" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">ssl_context_params</span><span
                class="attribute-access-type">[RW]</span>
            </div>

            <div class="method-description">
              <p>Hash for additional SSLContext parameters.</p>
              </div>
            </div>
          <div id="attribute-i-tls_hostname" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">tls_hostname</span><span
                class="attribute-access-type">[RW]</span>
            </div>

            <div class="method-description">
              <p>The hostname for verifying hostname in the server certificatate.</p>
              </div>
            </div>
          <div id="attribute-i-tls_verify" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">tls_verify</span><span
                class="attribute-access-type">[RW]</span>
            </div>

            <div class="method-description">
              <p>If <code>true</code>, verify th server’s certificate.</p>
              </div>
            </div>
            </section>


                <section id="public-class-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Class Methods</h3>
                </header>

                  <div id="method-c-default_port" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">default_port</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>The default <a href="SMTP.html"><code>SMTP</code></a> port number, 25.</p>

                              <div class="method-source-code" id="default_port-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 194</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">SMTP</span>.<span class="ruby-identifier ruby-title">default_port</span>
  <span class="ruby-value">25</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-default_ssl_context" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">default_ssl_context</span><span
                                class="method-args">(ssl_context_params = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="default_ssl_context-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 212</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">SMTP</span>.<span class="ruby-identifier ruby-title">default_ssl_context</span>(<span class="ruby-identifier">ssl_context_params</span> = <span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">context</span> = <span class="ruby-constant">OpenSSL</span><span class="ruby-operator">::</span><span class="ruby-constant">SSL</span><span class="ruby-operator">::</span><span class="ruby-constant">SSLContext</span>.<span class="ruby-identifier">new</span>
  <span class="ruby-identifier">context</span>.<span class="ruby-identifier">set_params</span>(<span class="ruby-identifier">ssl_context_params</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">ssl_context_params</span> <span class="ruby-operator">:</span> {})
  <span class="ruby-identifier">context</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-default_ssl_port" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">default_ssl_port</span><span
                                class="method-args">()</span>
                            </div>

                            <div class="method-description">
                              

                            </div>


                            <div class="aliases">
                              Alias for: <a href="SMTP.html#method-c-default_tls_port">default_tls_port</a>
                            </div>
                          </div>

                  <div id="method-c-default_submission_port" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">default_submission_port</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>The default mail submission port number, 587.</p>

                              <div class="method-source-code" id="default_submission_port-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 199</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">SMTP</span>.<span class="ruby-identifier ruby-title">default_submission_port</span>
  <span class="ruby-value">587</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-default_tls_port" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">default_tls_port</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>The default SMTPS port number, 465.</p>

                              <div class="method-source-code" id="default_tls_port-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 204</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">SMTP</span>.<span class="ruby-identifier ruby-title">default_tls_port</span>
  <span class="ruby-value">465</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="SMTP.html#method-c-default_ssl_port">default_ssl_port</a>
                            </div>

                          </div>

                  <div id="method-c-new" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">new</span><span
                                class="method-args">(address, port = nil, tls: false, starttls: :auto, tls_verify: true, tls_hostname: nil, ssl_context_params: nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Creates a new <a href="SMTP.html"><code>Net::SMTP</code></a> object.</p>

<p><code>address</code> is the hostname or ip address of your <a href="SMTP.html"><code>SMTP</code></a> server.  <code>port</code> is the port to connect to; it defaults to port 25.</p>

<p>If <code>tls</code> is true, enable TLS. The default is false. If <code>starttls</code> is :always, enable STARTTLS, if <code>:auto</code>, use STARTTLS when the server supports it, if false, disable STARTTLS.</p>

<p>If <code>tls_verify</code> is true, verify the server’s certificate. The default is true. If the hostname in the server certificate is different from <code>address</code>, it can be specified with <code>tls_hostname</code>.</p>

<p>Additional SSLContext params can be added to <code>ssl_context_params</code> hash argument and are passed to +OpenSSL::SSL::SSLContext#set_params+</p>

<p>+tls_verify: true+ is equivalent to +ssl_context_params: { verify_mode: OpenSSL::SSL::VERIFY_PEER }+. This method does not open the TCP connection.  You can use <a href="SMTP.html#method-c-start"><code>SMTP.start</code></a> instead of <a href="SMTP.html#method-c-new"><code>SMTP.new</code></a> if you want to do everything at once.  Otherwise, follow <a href="SMTP.html#method-c-new"><code>SMTP.new</code></a> with <a href="SMTP.html#method-i-start"><code>SMTP#start</code></a>.</p>

                              <div class="method-source-code" id="new-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 241</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">address</span>, <span class="ruby-identifier">port</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-value">tls:</span> <span class="ruby-keyword">false</span>, <span class="ruby-value">starttls:</span> <span class="ruby-value">:auto</span>, <span class="ruby-value">tls_verify:</span> <span class="ruby-keyword">true</span>, <span class="ruby-value">tls_hostname:</span> <span class="ruby-keyword">nil</span>, <span class="ruby-value">ssl_context_params:</span> <span class="ruby-keyword">nil</span>)
  <span class="ruby-ivar">@address</span> = <span class="ruby-identifier">address</span>
  <span class="ruby-ivar">@port</span> = (<span class="ruby-identifier">port</span> <span class="ruby-operator">||</span> <span class="ruby-constant">SMTP</span>.<span class="ruby-identifier">default_port</span>)
  <span class="ruby-ivar">@esmtp</span> = <span class="ruby-keyword">true</span>
  <span class="ruby-ivar">@capabilities</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-ivar">@socket</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-ivar">@started</span> = <span class="ruby-keyword">false</span>
  <span class="ruby-ivar">@open_timeout</span> = <span class="ruby-value">30</span>
  <span class="ruby-ivar">@read_timeout</span> = <span class="ruby-value">60</span>
  <span class="ruby-ivar">@error_occurred</span> = <span class="ruby-keyword">false</span>
  <span class="ruby-ivar">@debug_output</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-ivar">@tls</span> = <span class="ruby-identifier">tls</span>
  <span class="ruby-ivar">@starttls</span> = <span class="ruby-identifier">starttls</span>
  <span class="ruby-ivar">@ssl_context_tls</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-ivar">@ssl_context_starttls</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-ivar">@tls_verify</span> = <span class="ruby-identifier">tls_verify</span>
  <span class="ruby-ivar">@tls_hostname</span> = <span class="ruby-identifier">tls_hostname</span>
  <span class="ruby-ivar">@ssl_context_params</span> = <span class="ruby-identifier">ssl_context_params</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-start" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          start(address, port = nil, helo: &#39;localhost&#39;, user: nil, secret: nil, authtype: nil, tls: false, starttls: :auto, tls_verify: true, tls_hostname: nil, ssl_context_params: nil) { |smtp| ... }
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>
                      <div class="method-heading">
                        <span class="method-callseq">
                          start(address, port = nil, helo = &#39;localhost&#39;, user = nil, secret = nil, authtype = nil) { |smtp| ... }
                              </span>
                            </div>

                            <div class="method-description">
                              <p>Creates a new <a href="SMTP.html"><code>Net::SMTP</code></a> object and connects to the server.</p>

<p>This method is equivalent to:</p>

<pre class="ruby"><span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">SMTP</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">address</span>, <span class="ruby-identifier">port</span>).<span class="ruby-identifier">start</span>(<span class="ruby-value">helo:</span> <span class="ruby-identifier">helo_domain</span>, <span class="ruby-value">user:</span> <span class="ruby-identifier">account</span>, <span class="ruby-value">secret:</span> <span class="ruby-identifier">password</span>, <span class="ruby-value">authtype:</span> <span class="ruby-identifier">authtype</span>, <span class="ruby-value">tls_verify:</span> <span class="ruby-identifier">flag</span>, <span class="ruby-value">tls_hostname:</span> <span class="ruby-identifier">hostname</span>, <span class="ruby-value">ssl_context_params:</span> <span class="ruby-keyword">nil</span>)
</pre>

<h3 id="method-c-start-label-Example">Example<span><a href="#method-c-start-label-Example">&para;</a> <a href="#top">&uarr;</a></span></h3>

<pre class="ruby"><span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">SMTP</span>.<span class="ruby-identifier">start</span>(<span class="ruby-string">&#39;your.smtp.server&#39;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">smtp</span><span class="ruby-operator">|</span>
  <span class="ruby-identifier">smtp</span>.<span class="ruby-identifier">send_message</span> <span class="ruby-identifier">msgstr</span>, <span class="ruby-string">&#39;from@example.com&#39;</span>, [<span class="ruby-string">&#39;dest@example.com&#39;</span>]
<span class="ruby-keyword">end</span>
</pre>

<h3 id="method-c-start-label-Block+Usage">Block Usage<span><a href="#method-c-start-label-Block+Usage">&para;</a> <a href="#top">&uarr;</a></span></h3>

<p>If called with a block, the newly-opened <a href="SMTP.html"><code>Net::SMTP</code></a> object is yielded to the block, and automatically closed when the block finishes.  If called without a block, the newly-opened <a href="SMTP.html"><code>Net::SMTP</code></a> object is returned to the caller, and it is the caller’s responsibility to close it when finished.</p>

<h3 id="method-c-start-label-Parameters">Parameters<span><a href="#method-c-start-label-Parameters">&para;</a> <a href="#top">&uarr;</a></span></h3>

<p><code>address</code> is the hostname or ip address of your smtp server.</p>

<p><code>port</code> is the port to connect to; it defaults to port 25.</p>

<p><code>helo</code> is the <em>HELO</em> <em>domain</em> provided by the client to the server (see overview comments); it defaults to ‘localhost’.</p>

<p>The remaining arguments are used for <a href="SMTP.html"><code>SMTP</code></a> authentication, if required or desired.  <code>user</code> is the account name; <code>secret</code> is your password or other authentication token; and <code>authtype</code> is the authentication type, one of :plain, :login, or :cram_md5.  See the discussion of <a href="SMTP.html"><code>SMTP</code></a> Authentication in the overview notes.</p>

<p>If <code>tls</code> is true, enable TLS. The default is false. If <code>starttls</code> is :always, enable STARTTLS, if <code>:auto</code>, use STARTTLS when the server supports it, if false, disable STARTTLS.</p>

<p>If <code>tls_verify</code> is true, verify the server’s certificate. The default is true. If the hostname in the server certificate is different from <code>address</code>, it can be specified with <code>tls_hostname</code>.</p>

<p>Additional SSLContext params can be added to <code>ssl_context_params</code> hash argument and are passed to +OpenSSL::SSL::SSLContext#set_params+</p>

<p>+tls_verify: true+ is equivalent to +ssl_context_params: { verify_mode: OpenSSL::SSL::VERIFY_PEER }+.</p>

<h3 id="method-c-start-label-Errors">Errors<span><a href="#method-c-start-label-Errors">&para;</a> <a href="#top">&uarr;</a></span></h3>

<p>This method may raise:</p>
<ul><li>
<p><a href="SMTPAuthenticationError.html"><code>Net::SMTPAuthenticationError</code></a></p>
</li><li>
<p><a href="SMTPServerBusy.html"><code>Net::SMTPServerBusy</code></a></p>
</li><li>
<p><a href="SMTPSyntaxError.html"><code>Net::SMTPSyntaxError</code></a></p>
</li><li>
<p><a href="SMTPFatalError.html"><code>Net::SMTPFatalError</code></a></p>
</li><li>
<p><a href="SMTPUnknownError.html"><code>Net::SMTPUnknownError</code></a></p>
</li><li>
<p>Net::OpenTimeout</p>
</li><li>
<p>Net::ReadTimeout</p>
</li><li>
<p>IOError</p>
</li></ul>

                              <div class="method-source-code" id="start-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 518</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">SMTP</span>.<span class="ruby-identifier ruby-title">start</span>(<span class="ruby-identifier">address</span>, <span class="ruby-identifier">port</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-value">helo:</span> <span class="ruby-keyword">nil</span>,
               <span class="ruby-value">user:</span> <span class="ruby-keyword">nil</span>, <span class="ruby-value">secret:</span> <span class="ruby-keyword">nil</span>, <span class="ruby-value">password:</span> <span class="ruby-keyword">nil</span>, <span class="ruby-value">authtype:</span> <span class="ruby-keyword">nil</span>,
               <span class="ruby-value">tls:</span> <span class="ruby-keyword">false</span>, <span class="ruby-value">starttls:</span> <span class="ruby-value">:auto</span>,
               <span class="ruby-value">tls_verify:</span> <span class="ruby-keyword">true</span>, <span class="ruby-value">tls_hostname:</span> <span class="ruby-keyword">nil</span>, <span class="ruby-value">ssl_context_params:</span> <span class="ruby-keyword">nil</span>,
               <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">&quot;wrong number of arguments (given #{args.size + 2}, expected 1..6)&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">4</span>
  <span class="ruby-identifier">helo</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">args</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">||</span> <span class="ruby-string">&#39;localhost&#39;</span>
  <span class="ruby-identifier">user</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">args</span>[<span class="ruby-value">1</span>]
  <span class="ruby-identifier">secret</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">password</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">args</span>[<span class="ruby-value">2</span>]
  <span class="ruby-identifier">authtype</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">args</span>[<span class="ruby-value">3</span>]
  <span class="ruby-identifier">new</span>(<span class="ruby-identifier">address</span>, <span class="ruby-identifier">port</span>, <span class="ruby-value">tls:</span> <span class="ruby-identifier">tls</span>, <span class="ruby-value">starttls:</span> <span class="ruby-identifier">starttls</span>, <span class="ruby-value">tls_verify:</span> <span class="ruby-identifier">tls_verify</span>, <span class="ruby-value">tls_hostname:</span> <span class="ruby-identifier">tls_hostname</span>, <span class="ruby-value">ssl_context_params:</span> <span class="ruby-identifier">ssl_context_params</span>).<span class="ruby-identifier">start</span>(<span class="ruby-value">helo:</span> <span class="ruby-identifier">helo</span>, <span class="ruby-value">user:</span> <span class="ruby-identifier">user</span>, <span class="ruby-value">secret:</span> <span class="ruby-identifier">secret</span>, <span class="ruby-value">authtype:</span> <span class="ruby-identifier">authtype</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Instance Methods</h3>
                </header>

                  <div id="method-i-auth_cram_md5" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">auth_cram_md5</span><span
                                class="method-args">(user, secret)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="auth_cram_md5-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 860</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">auth_cram_md5</span>(<span class="ruby-identifier">user</span>, <span class="ruby-identifier">secret</span>)
  <span class="ruby-identifier">check_auth_args</span> <span class="ruby-identifier">user</span>, <span class="ruby-identifier">secret</span>
  <span class="ruby-identifier">res</span> = <span class="ruby-identifier">critical</span> {
    <span class="ruby-identifier">res0</span> = <span class="ruby-identifier">get_response</span>(<span class="ruby-string">&#39;AUTH CRAM-MD5&#39;</span>)
    <span class="ruby-identifier">check_auth_continue</span> <span class="ruby-identifier">res0</span>
    <span class="ruby-identifier">crammed</span> = <span class="ruby-identifier">cram_md5_response</span>(<span class="ruby-identifier">secret</span>, <span class="ruby-identifier">res0</span>.<span class="ruby-identifier">cram_md5_challenge</span>)
    <span class="ruby-identifier">get_response</span>(<span class="ruby-identifier">base64_encode</span>(<span class="ruby-node">&quot;#{user} #{crammed}&quot;</span>))
  }
  <span class="ruby-identifier">check_auth_response</span> <span class="ruby-identifier">res</span>
  <span class="ruby-identifier">res</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-auth_login" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">auth_login</span><span
                                class="method-args">(user, secret)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="auth_login-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 849</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">auth_login</span>(<span class="ruby-identifier">user</span>, <span class="ruby-identifier">secret</span>)
  <span class="ruby-identifier">check_auth_args</span> <span class="ruby-identifier">user</span>, <span class="ruby-identifier">secret</span>
  <span class="ruby-identifier">res</span> = <span class="ruby-identifier">critical</span> {
    <span class="ruby-identifier">check_auth_continue</span> <span class="ruby-identifier">get_response</span>(<span class="ruby-string">&#39;AUTH LOGIN&#39;</span>)
    <span class="ruby-identifier">check_auth_continue</span> <span class="ruby-identifier">get_response</span>(<span class="ruby-identifier">base64_encode</span>(<span class="ruby-identifier">user</span>))
    <span class="ruby-identifier">get_response</span>(<span class="ruby-identifier">base64_encode</span>(<span class="ruby-identifier">secret</span>))
  }
  <span class="ruby-identifier">check_auth_response</span> <span class="ruby-identifier">res</span>
  <span class="ruby-identifier">res</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-auth_plain" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">auth_plain</span><span
                                class="method-args">(user, secret)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="auth_plain-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 840</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">auth_plain</span>(<span class="ruby-identifier">user</span>, <span class="ruby-identifier">secret</span>)
  <span class="ruby-identifier">check_auth_args</span> <span class="ruby-identifier">user</span>, <span class="ruby-identifier">secret</span>
  <span class="ruby-identifier">res</span> = <span class="ruby-identifier">critical</span> {
    <span class="ruby-identifier">get_response</span>(<span class="ruby-string">&#39;AUTH PLAIN &#39;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">base64_encode</span>(<span class="ruby-node">&quot;\0#{user}\0#{secret}&quot;</span>))
  }
  <span class="ruby-identifier">check_auth_response</span> <span class="ruby-identifier">res</span>
  <span class="ruby-identifier">res</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-authenticate" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">authenticate</span><span
                                class="method-args">(user, secret, authtype = DEFAULT_AUTH_TYPE)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="authenticate-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 834</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">authenticate</span>(<span class="ruby-identifier">user</span>, <span class="ruby-identifier">secret</span>, <span class="ruby-identifier">authtype</span> = <span class="ruby-constant">DEFAULT_AUTH_TYPE</span>)
  <span class="ruby-identifier">check_auth_method</span> <span class="ruby-identifier">authtype</span>
  <span class="ruby-identifier">check_auth_args</span> <span class="ruby-identifier">user</span>, <span class="ruby-identifier">secret</span>
  <span class="ruby-identifier">public_send</span> <span class="ruby-identifier">auth_method</span>(<span class="ruby-identifier">authtype</span>), <span class="ruby-identifier">user</span>, <span class="ruby-identifier">secret</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-capable-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">capable?</span><span
                                class="method-args">(key)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>true if the EHLO response contains <code>key</code>.</p>

                              <div class="method-source-code" id="capable-3F-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 294</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">capable?</span>(<span class="ruby-identifier">key</span>)
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">nil</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@capabilities</span>
  <span class="ruby-ivar">@capabilities</span>[<span class="ruby-identifier">key</span>] <span class="ruby-operator">?</span> <span class="ruby-keyword">true</span> <span class="ruby-operator">:</span> <span class="ruby-keyword">false</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-capable_auth_types" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">capable_auth_types</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns supported authentication methods on this server. You cannot get valid value before opening <a href="SMTP.html"><code>SMTP</code></a> session.</p>

                              <div class="method-source-code" id="capable_auth_types-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 329</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">capable_auth_types</span>
  <span class="ruby-keyword">return</span> [] <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@capabilities</span>
  <span class="ruby-keyword">return</span> [] <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@capabilities</span>[<span class="ruby-string">&#39;AUTH&#39;</span>]
  <span class="ruby-ivar">@capabilities</span>[<span class="ruby-string">&#39;AUTH&#39;</span>]
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-capable_cram_md5_auth-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">capable_cram_md5_auth?</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>true if server advertises AUTH CRAM-MD5. You cannot get valid value before opening <a href="SMTP.html"><code>SMTP</code></a> session.</p>

                              <div class="method-source-code" id="capable_cram_md5_auth-3F-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 316</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">capable_cram_md5_auth?</span>
  <span class="ruby-identifier">auth_capable?</span>(<span class="ruby-string">&#39;CRAM-MD5&#39;</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-capable_login_auth-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">capable_login_auth?</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>true if server advertises AUTH LOGIN. You cannot get valid value before opening <a href="SMTP.html"><code>SMTP</code></a> session.</p>

                              <div class="method-source-code" id="capable_login_auth-3F-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 310</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">capable_login_auth?</span>
  <span class="ruby-identifier">auth_capable?</span>(<span class="ruby-string">&#39;LOGIN&#39;</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-capable_plain_auth-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">capable_plain_auth?</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>true if server advertises AUTH PLAIN. You cannot get valid value before opening <a href="SMTP.html"><code>SMTP</code></a> session.</p>

                              <div class="method-source-code" id="capable_plain_auth-3F-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 304</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">capable_plain_auth?</span>
  <span class="ruby-identifier">auth_capable?</span>(<span class="ruby-string">&#39;PLAIN&#39;</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-capable_starttls-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">capable_starttls?</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>true if server advertises STARTTLS. You cannot get valid value before opening <a href="SMTP.html"><code>SMTP</code></a> session.</p>

                              <div class="method-source-code" id="capable_starttls-3F-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 289</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">capable_starttls?</span>
  <span class="ruby-identifier">capable?</span>(<span class="ruby-string">&#39;STARTTLS&#39;</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-data" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">data</span><span
                                class="method-args">(msgstr = nil) { |stream| ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>This method sends a message. If <code>msgstr</code> is given, sends it as a message. If block is given, yield a message writer stream. You must write message before the block is closed.</p>

<pre class="ruby"><span class="ruby-comment"># Example 1 (by string)</span>
<span class="ruby-identifier">smtp</span>.<span class="ruby-identifier">data</span>(<span class="ruby-identifier">&lt;&lt;EndMessage</span>)
<span class="ruby-value">From: john@example.com
To: betty@example.com
Subject: I found a bug

Check vm.c:58879.
</span><span class="ruby-identifier">EndMessage</span>

<span class="ruby-comment"># Example 2 (by block)</span>
<span class="ruby-identifier">smtp</span>.<span class="ruby-identifier">data</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
  <span class="ruby-identifier">f</span>.<span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;From: john@example.com&quot;</span>
  <span class="ruby-identifier">f</span>.<span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;To: betty@example.com&quot;</span>
  <span class="ruby-identifier">f</span>.<span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;Subject: I found a bug&quot;</span>
  <span class="ruby-identifier">f</span>.<span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;&quot;</span>
  <span class="ruby-identifier">f</span>.<span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;Check vm.c:58879.&quot;</span>
}
</pre>

                              <div class="method-source-code" id="data-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 998</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">data</span>(<span class="ruby-identifier">msgstr</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)   <span class="ruby-comment">#:yield: stream</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">msgstr</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">block</span>
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-string">&quot;message and block are exclusive&quot;</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">unless</span> <span class="ruby-identifier">msgstr</span> <span class="ruby-keyword">or</span> <span class="ruby-identifier">block</span>
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-string">&quot;message or block is required&quot;</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">res</span> = <span class="ruby-identifier">critical</span> {
    <span class="ruby-identifier">check_continue</span> <span class="ruby-identifier">get_response</span>(<span class="ruby-string">&#39;DATA&#39;</span>)
    <span class="ruby-identifier">socket_sync_bak</span> = <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">io</span>.<span class="ruby-identifier">sync</span>
    <span class="ruby-keyword">begin</span>
      <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">io</span>.<span class="ruby-identifier">sync</span> = <span class="ruby-keyword">false</span>
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">msgstr</span>
        <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">write_message</span> <span class="ruby-identifier">msgstr</span>
      <span class="ruby-keyword">else</span>
        <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">write_message_by_block</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">ensure</span>
      <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">io</span>.<span class="ruby-identifier">flush</span>
      <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">io</span>.<span class="ruby-identifier">sync</span> = <span class="ruby-identifier">socket_sync_bak</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">recv_response</span>()
  }
  <span class="ruby-identifier">check_response</span> <span class="ruby-identifier">res</span>
  <span class="ruby-identifier">res</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-debug_output-3D" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">debug_output=</span><span
                                class="method-args">(arg)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>WARNING: This method causes serious security holes. Use this method for only debugging.</p>

<p>Set an output stream for debug logging. You must call this before <a href="SMTP.html#method-i-start"><code>start</code></a>.</p>

<pre># example
smtp = Net::SMTP.new(addr, port)
smtp.set_debug_output $stderr
smtp.start do |smtp|
  ....
end</pre>

                              <div class="method-source-code" id="debug_output-3D-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 442</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">debug_output=</span>(<span class="ruby-identifier">arg</span>)
  <span class="ruby-ivar">@debug_output</span> = <span class="ruby-identifier">arg</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="SMTP.html#method-i-set_debug_output">set_debug_output</a>
                            </div>

                          </div>

                  <div id="method-i-disable_ssl" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">disable_ssl</span><span
                                class="method-args">()</span>
                            </div>

                            <div class="method-description">
                              

                            </div>


                            <div class="aliases">
                              Alias for: <a href="SMTP.html#method-i-disable_tls">disable_tls</a>
                            </div>
                          </div>

                  <div id="method-i-disable_starttls" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">disable_starttls</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Disables SMTP/TLS (STARTTLS) for this object.  Must be called before the connection is established to have any effect.</p>

                              <div class="method-source-code" id="disable_starttls-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 400</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">disable_starttls</span>
  <span class="ruby-ivar">@starttls</span> = <span class="ruby-keyword">false</span>
  <span class="ruby-ivar">@ssl_context_starttls</span> = <span class="ruby-keyword">nil</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-disable_tls" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">disable_tls</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Disables SMTP/TLS for this object.  Must be called before the connection is established to have any effect.</p>

                              <div class="method-source-code" id="disable_tls-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 356</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">disable_tls</span>
  <span class="ruby-ivar">@tls</span> = <span class="ruby-keyword">false</span>
  <span class="ruby-ivar">@ssl_context_tls</span> = <span class="ruby-keyword">nil</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="SMTP.html#method-i-disable_ssl">disable_ssl</a>
                            </div>

                          </div>

                  <div id="method-i-ehlo" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">ehlo</span><span
                                class="method-args">(domain)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="ehlo-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 938</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">ehlo</span>(<span class="ruby-identifier">domain</span>)
  <span class="ruby-identifier">getok</span>(<span class="ruby-node">&quot;EHLO #{domain}&quot;</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-enable_ssl" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">enable_ssl</span><span
                                class="method-args">(context = nil)</span>
                            </div>

                            <div class="method-description">
                              

                            </div>


                            <div class="aliases">
                              Alias for: <a href="SMTP.html#method-i-enable_tls">enable_tls</a>
                            </div>
                          </div>

                  <div id="method-i-enable_starttls" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">enable_starttls</span><span
                                class="method-args">(context = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Enables SMTP/TLS (STARTTLS) for this object. <code>context</code> is a OpenSSL::SSL::SSLContext object.</p>

                              <div class="method-source-code" id="enable_starttls-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 382</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">enable_starttls</span>(<span class="ruby-identifier">context</span> = <span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">raise</span> <span class="ruby-string">&#39;openssl library not installed&#39;</span> <span class="ruby-keyword">unless</span> <span class="ruby-keyword">defined?</span>(<span class="ruby-constant">OpenSSL</span><span class="ruby-operator">::</span><span class="ruby-constant">VERSION</span>)
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-string">&quot;SMTPS and STARTTLS is exclusive&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@tls</span>
  <span class="ruby-ivar">@starttls</span> = <span class="ruby-value">:always</span>
  <span class="ruby-ivar">@ssl_context_starttls</span> = <span class="ruby-identifier">context</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-enable_starttls_auto" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">enable_starttls_auto</span><span
                                class="method-args">(context = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Enables SMTP/TLS (STARTTLS) for this object if server accepts. <code>context</code> is a OpenSSL::SSL::SSLContext object.</p>

                              <div class="method-source-code" id="enable_starttls_auto-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 391</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">enable_starttls_auto</span>(<span class="ruby-identifier">context</span> = <span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">raise</span> <span class="ruby-string">&#39;openssl library not installed&#39;</span> <span class="ruby-keyword">unless</span> <span class="ruby-keyword">defined?</span>(<span class="ruby-constant">OpenSSL</span><span class="ruby-operator">::</span><span class="ruby-constant">VERSION</span>)
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-string">&quot;SMTPS and STARTTLS is exclusive&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@tls</span>
  <span class="ruby-ivar">@starttls</span> = <span class="ruby-value">:auto</span>
  <span class="ruby-ivar">@ssl_context_starttls</span> = <span class="ruby-identifier">context</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-enable_tls" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">enable_tls</span><span
                                class="method-args">(context = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Enables SMTP/TLS (SMTPS: <a href="SMTP.html"><code>SMTP</code></a> over direct TLS connection) for this object.  Must be called before the connection is established to have any effect.  <code>context</code> is a OpenSSL::SSL::SSLContext object.</p>

                              <div class="method-source-code" id="enable_tls-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 345</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">enable_tls</span>(<span class="ruby-identifier">context</span> = <span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">raise</span> <span class="ruby-string">&#39;openssl library not installed&#39;</span> <span class="ruby-keyword">unless</span> <span class="ruby-keyword">defined?</span>(<span class="ruby-constant">OpenSSL</span><span class="ruby-operator">::</span><span class="ruby-constant">VERSION</span>)
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-string">&quot;SMTPS and STARTTLS is exclusive&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@starttls</span> <span class="ruby-operator">==</span> <span class="ruby-value">:always</span>
  <span class="ruby-ivar">@tls</span> = <span class="ruby-keyword">true</span>
  <span class="ruby-ivar">@ssl_context_tls</span> = <span class="ruby-identifier">context</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="SMTP.html#method-i-enable_ssl">enable_ssl</a>
                            </div>

                          </div>

                  <div id="method-i-finish" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">finish</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Finishes the <a href="SMTP.html"><code>SMTP</code></a> session and closes TCP connection. Raises IOError if not started.</p>

                              <div class="method-source-code" id="finish-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 624</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">finish</span>
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">IOError</span>, <span class="ruby-string">&#39;not yet started&#39;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">started?</span>
  <span class="ruby-identifier">do_finish</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-helo" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">helo</span><span
                                class="method-args">(domain)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="helo-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 934</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">helo</span>(<span class="ruby-identifier">domain</span>)
  <span class="ruby-identifier">getok</span>(<span class="ruby-node">&quot;HELO #{domain}&quot;</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-inspect" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">inspect</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Provide human-readable stringification of class state.</p>

                              <div class="method-source-code" id="inspect-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 271</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">inspect</span>
  <span class="ruby-node">&quot;#&lt;#{self.class} #{@address}:#{@port} started=#{@started}&gt;&quot;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-mailfrom" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">mailfrom</span><span
                                class="method-args">(from_addr)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p><code>from_addr</code> is <code>String</code> or <code>Net::SMTP::Address</code></p>

                              <div class="method-source-code" id="mailfrom-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 943</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">mailfrom</span>(<span class="ruby-identifier">from_addr</span>)
  <span class="ruby-identifier">addr</span> = <span class="ruby-constant">Address</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">from_addr</span>)
  <span class="ruby-identifier">getok</span>(([<span class="ruby-node">&quot;MAIL FROM:&lt;#{addr.address}&gt;&quot;</span>] <span class="ruby-operator">+</span> <span class="ruby-identifier">addr</span>.<span class="ruby-identifier">parameters</span>).<span class="ruby-identifier">join</span>(<span class="ruby-string">&#39; &#39;</span>))
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-open_message_stream" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">open_message_stream</span><span
                                class="method-args">(from_addr, *to_addrs) { |stream| ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Opens a message writer stream and gives it to the block. The stream is valid only in the block, and has these methods:</p>
<dl class="rdoc-list note-list"><dt>puts(str = ”)
<dd>
<p>outputs STR and CR LF.</p>
</dd><dt>print(str)
<dd>
<p>outputs STR.</p>
</dd><dt>printf(fmt, *args)
<dd>
<p>outputs sprintf(fmt,*args).</p>
</dd><dt>write(str)
<dd>
<p>outputs STR and returns the length of written bytes.</p>
</dd><dt>&lt;&lt;(str)
<dd>
<p>outputs STR and returns self.</p>
</dd></dl>

<p>If a single CR (“r”) or LF (“n”) is found in the message, it is converted to the CR LF pair.  You cannot send a binary message with this method.</p>

<h3 id="method-i-open_message_stream-label-Parameters">Parameters<span><a href="#method-i-open_message_stream-label-Parameters">&para;</a> <a href="#top">&uarr;</a></span></h3>

<p><code>from_addr</code> is a String or <a href="SMTP/Address.html"><code>Net::SMTP::Address</code></a> representing the source mail address.</p>

<p><code>to_addr</code> is a String or <a href="SMTP/Address.html"><code>Net::SMTP::Address</code></a> or Array of them, representing the destination mail address or addresses.</p>

<h3 id="method-i-open_message_stream-label-Example">Example<span><a href="#method-i-open_message_stream-label-Example">&para;</a> <a href="#top">&uarr;</a></span></h3>

<pre class="ruby"><span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">SMTP</span>.<span class="ruby-identifier">start</span>(<span class="ruby-string">&#39;smtp.example.com&#39;</span>, <span class="ruby-value">25</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">smtp</span><span class="ruby-operator">|</span>
  <span class="ruby-identifier">smtp</span>.<span class="ruby-identifier">open_message_stream</span>(<span class="ruby-string">&#39;from@example.com&#39;</span>, [<span class="ruby-string">&#39;dest@example.com&#39;</span>]) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">f</span>.<span class="ruby-identifier">puts</span> <span class="ruby-string">&#39;From: from@example.com&#39;</span>
    <span class="ruby-identifier">f</span>.<span class="ruby-identifier">puts</span> <span class="ruby-string">&#39;To: dest@example.com&#39;</span>
    <span class="ruby-identifier">f</span>.<span class="ruby-identifier">puts</span> <span class="ruby-string">&#39;Subject: test message&#39;</span>
    <span class="ruby-identifier">f</span>.<span class="ruby-identifier">puts</span>
    <span class="ruby-identifier">f</span>.<span class="ruby-identifier">puts</span> <span class="ruby-string">&#39;This is a test message.&#39;</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span>
</pre>

<h3 id="method-i-open_message_stream-label-Errors">Errors<span><a href="#method-i-open_message_stream-label-Errors">&para;</a> <a href="#top">&uarr;</a></span></h3>

<p>This method may raise:</p>
<ul><li>
<p><a href="SMTPServerBusy.html"><code>Net::SMTPServerBusy</code></a></p>
</li><li>
<p><a href="SMTPSyntaxError.html"><code>Net::SMTPSyntaxError</code></a></p>
</li><li>
<p><a href="SMTPFatalError.html"><code>Net::SMTPFatalError</code></a></p>
</li><li>
<p><a href="SMTPUnknownError.html"><code>Net::SMTPUnknownError</code></a></p>
</li><li>
<p>Net::ReadTimeout</p>
</li><li>
<p>IOError</p>
</li></ul>

                              <div class="method-source-code" id="open_message_stream-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 818</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">open_message_stream</span>(<span class="ruby-identifier">from_addr</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">to_addrs</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)   <span class="ruby-comment"># :yield: stream</span>
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">IOError</span>, <span class="ruby-string">&#39;closed session&#39;</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@socket</span>
  <span class="ruby-identifier">mailfrom</span> <span class="ruby-identifier">from_addr</span>
  <span class="ruby-identifier">rcptto_list</span>(<span class="ruby-identifier">to_addrs</span>) {<span class="ruby-identifier">data</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)}
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="SMTP.html#method-i-ready">ready</a>
                            </div>

                          </div>

                  <div id="method-i-quit" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">quit</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="quit-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 1025</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">quit</span>
  <span class="ruby-identifier">getok</span>(<span class="ruby-string">&#39;QUIT&#39;</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-rcptto" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">rcptto</span><span
                                class="method-args">(to_addr)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p><code>to_addr</code> is <code>String</code> or <code>Net::SMTP::Address</code></p>

                              <div class="method-source-code" id="rcptto-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 970</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">rcptto</span>(<span class="ruby-identifier">to_addr</span>)
  <span class="ruby-identifier">addr</span> = <span class="ruby-constant">Address</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">to_addr</span>)
  <span class="ruby-identifier">getok</span>(([<span class="ruby-node">&quot;RCPT TO:&lt;#{addr.address}&gt;&quot;</span>] <span class="ruby-operator">+</span> <span class="ruby-identifier">addr</span>.<span class="ruby-identifier">parameters</span>).<span class="ruby-identifier">join</span>(<span class="ruby-string">&#39; &#39;</span>))
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-rcptto_list" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">rcptto_list</span><span
                                class="method-args">(to_addrs) { || ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="rcptto_list-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 948</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">rcptto_list</span>(<span class="ruby-identifier">to_addrs</span>)
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-string">&#39;mail destination not given&#39;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">to_addrs</span>.<span class="ruby-identifier">empty?</span>
  <span class="ruby-identifier">ok_users</span> = []
  <span class="ruby-identifier">unknown_users</span> = []
  <span class="ruby-identifier">to_addrs</span>.<span class="ruby-identifier">flatten</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">addr</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">begin</span>
      <span class="ruby-identifier">rcptto</span> <span class="ruby-identifier">addr</span>
    <span class="ruby-keyword">rescue</span> <span class="ruby-constant">SMTPAuthenticationError</span>
      <span class="ruby-identifier">unknown_users</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">addr</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">dump</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">ok_users</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">addr</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-string">&#39;mail destination not given&#39;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">ok_users</span>.<span class="ruby-identifier">empty?</span>
  <span class="ruby-identifier">ret</span> = <span class="ruby-keyword">yield</span>
  <span class="ruby-keyword">unless</span> <span class="ruby-identifier">unknown_users</span>.<span class="ruby-identifier">empty?</span>
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">SMTPAuthenticationError</span>, <span class="ruby-node">&quot;failed to deliver for #{unknown_users.join(&#39;, &#39;)}&quot;</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">ret</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-read_timeout-3D" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">read_timeout=</span><span
                                class="method-args">(sec)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Set the number of seconds to wait until timing-out a read(2) call.</p>

                              <div class="method-source-code" id="read_timeout-3D-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 423</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">read_timeout=</span>(<span class="ruby-identifier">sec</span>)
  <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">read_timeout</span> = <span class="ruby-identifier">sec</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@socket</span>
  <span class="ruby-ivar">@read_timeout</span> = <span class="ruby-identifier">sec</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-ready" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">ready</span><span
                                class="method-args">(from_addr, *to_addrs)</span>
                            </div>

                            <div class="method-description">
                              

                            </div>


                            <div class="aliases">
                              Alias for: <a href="SMTP.html#method-i-open_message_stream">open_message_stream</a>
                            </div>
                          </div>

                  <div id="method-i-rset" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">rset</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Aborts the current mail transaction</p>

                              <div class="method-source-code" id="rset-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 926</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">rset</span>
  <span class="ruby-identifier">getok</span>(<span class="ruby-string">&#39;RSET&#39;</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-send_mail" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">send_mail</span><span
                                class="method-args">(msgstr, from_addr, *to_addrs)</span>
                            </div>

                            <div class="method-description">
                              

                            </div>


                            <div class="aliases">
                              Alias for: <a href="SMTP.html#method-i-send_message">send_message</a>
                            </div>
                          </div>

                  <div id="method-i-send_message" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">send_message</span><span
                                class="method-args">(msgstr, from_addr, *to_addrs)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Sends <code>msgstr</code> as a message.  Single CR (“r”) and LF (“n”) found in the <code>msgstr</code>, are converted into the CR LF pair.  You cannot send a binary message with this method. <code>msgstr</code> should include both the message headers and body.</p>

<p><code>from_addr</code> is a String or <a href="SMTP/Address.html"><code>Net::SMTP::Address</code></a> representing the source mail address.</p>

<p><code>to_addr</code> is a String or <a href="SMTP/Address.html"><code>Net::SMTP::Address</code></a> or Array of them, representing the destination mail address or addresses.</p>

<h3 id="method-i-send_message-label-Example">Example<span><a href="#method-i-send_message-label-Example">&para;</a> <a href="#top">&uarr;</a></span></h3>

<pre class="ruby"><span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">SMTP</span>.<span class="ruby-identifier">start</span>(<span class="ruby-string">&#39;smtp.example.com&#39;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">smtp</span><span class="ruby-operator">|</span>
  <span class="ruby-identifier">smtp</span>.<span class="ruby-identifier">send_message</span> <span class="ruby-identifier">msgstr</span>,
                    <span class="ruby-string">&#39;from@example.com&#39;</span>,
                    [<span class="ruby-string">&#39;dest@example.com&#39;</span>, <span class="ruby-string">&#39;dest2@example.com&#39;</span>]
<span class="ruby-keyword">end</span>

<span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">SMTP</span>.<span class="ruby-identifier">start</span>(<span class="ruby-string">&#39;smtp.example.com&#39;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">smtp</span><span class="ruby-operator">|</span>
  <span class="ruby-identifier">smtp</span>.<span class="ruby-identifier">send_message</span> <span class="ruby-identifier">msgstr</span>,
                    <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">SMTP</span><span class="ruby-operator">::</span><span class="ruby-constant">Address</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&#39;from@example.com&#39;</span>, <span class="ruby-value">size:</span> <span class="ruby-value">12345</span>),
                    <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">SMTP</span><span class="ruby-operator">::</span><span class="ruby-constant">Address</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&#39;dest@example.com&#39;</span>, <span class="ruby-value">notify:</span> <span class="ruby-value">:success</span>)
<span class="ruby-keyword">end</span>
</pre>

<h3 id="method-i-send_message-label-Errors">Errors<span><a href="#method-i-send_message-label-Errors">&para;</a> <a href="#top">&uarr;</a></span></h3>

<p>This method may raise:</p>
<ul><li>
<p><a href="SMTPServerBusy.html"><code>Net::SMTPServerBusy</code></a></p>
</li><li>
<p><a href="SMTPSyntaxError.html"><code>Net::SMTPSyntaxError</code></a></p>
</li><li>
<p><a href="SMTPFatalError.html"><code>Net::SMTPFatalError</code></a></p>
</li><li>
<p><a href="SMTPUnknownError.html"><code>Net::SMTPUnknownError</code></a></p>
</li><li>
<p>Net::ReadTimeout</p>
</li><li>
<p>IOError</p>
</li></ul>

                              <div class="method-source-code" id="send_message-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 765</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">send_message</span>(<span class="ruby-identifier">msgstr</span>, <span class="ruby-identifier">from_addr</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">to_addrs</span>)
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">IOError</span>, <span class="ruby-string">&#39;closed session&#39;</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@socket</span>
  <span class="ruby-identifier">mailfrom</span> <span class="ruby-identifier">from_addr</span>
  <span class="ruby-identifier">rcptto_list</span>(<span class="ruby-identifier">to_addrs</span>) {<span class="ruby-identifier">data</span> <span class="ruby-identifier">msgstr</span>}
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="SMTP.html#method-i-send_mail">send_mail</a>, <a href="SMTP.html#method-i-sendmail">sendmail</a>
                            </div>

                          </div>

                  <div id="method-i-sendmail" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">sendmail</span><span
                                class="method-args">(msgstr, from_addr, *to_addrs)</span>
                            </div>

                            <div class="method-description">
                              

                            </div>


                            <div class="aliases">
                              Alias for: <a href="SMTP.html#method-i-send_message">send_message</a>
                            </div>
                          </div>

                  <div id="method-i-set_debug_output" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">set_debug_output</span><span
                                class="method-args">(arg)</span>
                            </div>

                            <div class="method-description">
                              

                            </div>


                            <div class="aliases">
                              Alias for: <a href="SMTP.html#method-i-debug_output-3D">debug_output=</a>
                            </div>
                          </div>

                  <div id="method-i-ssl-3F" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">ssl?</span><span
                                class="method-args">()</span>
                            </div>

                            <div class="method-description">
                              

                            </div>


                            <div class="aliases">
                              Alias for: <a href="SMTP.html#method-i-tls-3F">tls?</a>
                            </div>
                          </div>

                  <div id="method-i-start" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          start(helo: &#39;localhost&#39;, user: nil, secret: nil, authtype: nil) { |smtp| ... }
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>
                      <div class="method-heading">
                        <span class="method-callseq">
                          start(helo = &#39;localhost&#39;, user = nil, secret = nil, authtype = nil) { |smtp| ... }
                              </span>
                            </div>

                            <div class="method-description">
                              <p>Opens a TCP connection and starts the <a href="SMTP.html"><code>SMTP</code></a> session.</p>

<h3 id="method-i-start-label-Parameters">Parameters<span><a href="#method-i-start-label-Parameters">&para;</a> <a href="#top">&uarr;</a></span></h3>

<p><code>helo</code> is the <em>HELO</em> <em>domain</em> that you’ll dispatch mails from; see the discussion in the overview notes.</p>

<p>If both of <code>user</code> and <code>secret</code> are given, <a href="SMTP.html"><code>SMTP</code></a> authentication will be attempted using the AUTH command.  <code>authtype</code> specifies the type of authentication to attempt; it must be one of :login, :plain, and :cram_md5.  See the notes on <a href="SMTP.html"><code>SMTP</code></a> Authentication in the overview.</p>

<h3 id="method-i-start-label-Block+Usage">Block Usage<span><a href="#method-i-start-label-Block+Usage">&para;</a> <a href="#top">&uarr;</a></span></h3>

<p>When this methods is called with a block, the newly-started <a href="SMTP.html"><code>SMTP</code></a> object is yielded to the block, and automatically closed after the block call finishes.  Otherwise, it is the caller’s responsibility to close the session when finished.</p>

<h3 id="method-i-start-label-Example">Example<span><a href="#method-i-start-label-Example">&para;</a> <a href="#top">&uarr;</a></span></h3>

<p>This is very similar to the class method <a href="SMTP.html#method-c-start"><code>SMTP.start</code></a>.</p>

<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">&#39;net/smtp&#39;</span>
<span class="ruby-identifier">smtp</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">SMTP</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&#39;smtp.mail.server&#39;</span>, <span class="ruby-value">25</span>)
<span class="ruby-identifier">smtp</span>.<span class="ruby-identifier">start</span>(<span class="ruby-value">helo:</span> <span class="ruby-identifier">helo_domain</span>, <span class="ruby-value">user:</span> <span class="ruby-identifier">account</span>, <span class="ruby-value">secret:</span> <span class="ruby-identifier">password</span>, <span class="ruby-value">authtype:</span> <span class="ruby-identifier">authtype</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">smtp</span><span class="ruby-operator">|</span>
  <span class="ruby-identifier">smtp</span>.<span class="ruby-identifier">send_message</span> <span class="ruby-identifier">msgstr</span>, <span class="ruby-string">&#39;from@example.com&#39;</span>, [<span class="ruby-string">&#39;dest@example.com&#39;</span>]
<span class="ruby-keyword">end</span>
</pre>

<p>The primary use of this method (as opposed to <a href="SMTP.html#method-c-start"><code>SMTP.start</code></a>) is probably to set debugging (<a href="SMTP.html#method-i-set_debug_output"><code>set_debug_output</code></a>) or ESMTP (<a href="SMTP.html#attribute-i-esmtp"><code>esmtp=</code></a>), which must be done before the session is started.</p>

<h3 id="method-i-start-label-Errors">Errors<span><a href="#method-i-start-label-Errors">&para;</a> <a href="#top">&uarr;</a></span></h3>

<p>If session has already been started, an IOError will be raised.</p>

<p>This method may raise:</p>
<ul><li>
<p><a href="SMTPAuthenticationError.html"><code>Net::SMTPAuthenticationError</code></a></p>
</li><li>
<p><a href="SMTPServerBusy.html"><code>Net::SMTPServerBusy</code></a></p>
</li><li>
<p><a href="SMTPSyntaxError.html"><code>Net::SMTPSyntaxError</code></a></p>
</li><li>
<p><a href="SMTPFatalError.html"><code>Net::SMTPFatalError</code></a></p>
</li><li>
<p><a href="SMTPUnknownError.html"><code>Net::SMTPUnknownError</code></a></p>
</li><li>
<p>Net::OpenTimeout</p>
</li><li>
<p>Net::ReadTimeout</p>
</li><li>
<p>IOError</p>
</li></ul>

                              <div class="method-source-code" id="start-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 591</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">start</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-value">helo:</span> <span class="ruby-keyword">nil</span>, <span class="ruby-value">user:</span> <span class="ruby-keyword">nil</span>, <span class="ruby-value">secret:</span> <span class="ruby-keyword">nil</span>, <span class="ruby-value">password:</span> <span class="ruby-keyword">nil</span>, <span class="ruby-value">authtype:</span> <span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">&quot;wrong number of arguments (given #{args.size}, expected 0..4)&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">4</span>
  <span class="ruby-identifier">helo</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">args</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">||</span> <span class="ruby-string">&#39;localhost&#39;</span>
  <span class="ruby-identifier">user</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">args</span>[<span class="ruby-value">1</span>]
  <span class="ruby-identifier">secret</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">password</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">args</span>[<span class="ruby-value">2</span>]
  <span class="ruby-identifier">authtype</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">args</span>[<span class="ruby-value">3</span>]
  <span class="ruby-keyword">if</span> <span class="ruby-keyword">defined?</span>(<span class="ruby-constant">OpenSSL</span><span class="ruby-operator">::</span><span class="ruby-constant">VERSION</span>)
    <span class="ruby-identifier">ssl_context_params</span> = <span class="ruby-ivar">@ssl_context_params</span> <span class="ruby-operator">||</span> {}
    <span class="ruby-keyword">unless</span> <span class="ruby-identifier">ssl_context_params</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-value">:verify_mode</span>)
      <span class="ruby-identifier">ssl_context_params</span>[<span class="ruby-value">:verify_mode</span>] = <span class="ruby-ivar">@tls_verify</span> <span class="ruby-operator">?</span> <span class="ruby-constant">OpenSSL</span><span class="ruby-operator">::</span><span class="ruby-constant">SSL</span><span class="ruby-operator">::</span><span class="ruby-constant">VERIFY_PEER</span> <span class="ruby-operator">:</span> <span class="ruby-constant">OpenSSL</span><span class="ruby-operator">::</span><span class="ruby-constant">SSL</span><span class="ruby-operator">::</span><span class="ruby-constant">VERIFY_NONE</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">if</span> <span class="ruby-ivar">@tls</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-ivar">@ssl_context_tls</span>.<span class="ruby-identifier">nil?</span>
      <span class="ruby-ivar">@ssl_context_tls</span> = <span class="ruby-constant">SMTP</span>.<span class="ruby-identifier">default_ssl_context</span>(<span class="ruby-identifier">ssl_context_params</span>)
    <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">if</span> <span class="ruby-ivar">@starttls</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-ivar">@ssl_context_starttls</span>.<span class="ruby-identifier">nil?</span>
      <span class="ruby-ivar">@ssl_context_starttls</span> = <span class="ruby-constant">SMTP</span>.<span class="ruby-identifier">default_ssl_context</span>(<span class="ruby-identifier">ssl_context_params</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">block_given?</span>
    <span class="ruby-keyword">begin</span>
      <span class="ruby-identifier">do_start</span> <span class="ruby-identifier">helo</span>, <span class="ruby-identifier">user</span>, <span class="ruby-identifier">secret</span>, <span class="ruby-identifier">authtype</span>
      <span class="ruby-keyword">return</span> <span class="ruby-keyword">yield</span>(<span class="ruby-keyword">self</span>)
    <span class="ruby-keyword">ensure</span>
      <span class="ruby-identifier">do_finish</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">do_start</span> <span class="ruby-identifier">helo</span>, <span class="ruby-identifier">user</span>, <span class="ruby-identifier">secret</span>, <span class="ruby-identifier">authtype</span>
    <span class="ruby-keyword">return</span> <span class="ruby-keyword">self</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-started-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">started?</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p><code>true</code> if the <a href="SMTP.html"><code>SMTP</code></a> session has been started.</p>

                              <div class="method-source-code" id="started-3F-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 532</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">started?</span>
  <span class="ruby-ivar">@started</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-starttls" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">starttls</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="starttls-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 930</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">starttls</span>
  <span class="ruby-identifier">getok</span>(<span class="ruby-string">&#39;STARTTLS&#39;</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-starttls-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">starttls?</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns truth value if this object uses STARTTLS. If this object always uses STARTTLS, returns :always. If this object uses STARTTLS when the server support TLS, returns :auto.</p>

                              <div class="method-source-code" id="starttls-3F-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 366</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">starttls?</span>
  <span class="ruby-ivar">@starttls</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-starttls_always-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">starttls_always?</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>true if this object uses STARTTLS.</p>

                              <div class="method-source-code" id="starttls_always-3F-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 371</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">starttls_always?</span>
  <span class="ruby-ivar">@starttls</span> <span class="ruby-operator">==</span> <span class="ruby-value">:always</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-starttls_auto-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">starttls_auto?</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>true if this object uses STARTTLS when server advertises STARTTLS.</p>

                              <div class="method-source-code" id="starttls_auto-3F-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 376</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">starttls_auto?</span>
  <span class="ruby-ivar">@starttls</span> <span class="ruby-operator">==</span> <span class="ruby-value">:auto</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-tls-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">tls?</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>true if this object uses SMTP/TLS (SMTPS).</p>

                              <div class="method-source-code" id="tls-3F-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 336</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">tls?</span>
  <span class="ruby-ivar">@tls</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="SMTP.html#method-i-ssl-3F">ssl?</a>
                            </div>

                          </div>

                          </section>

                <section id="private-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Private Instance Methods</h3>
                </header>

                  <div id="method-i-auth_capable-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">auth_capable?</span><span
                                class="method-args">(type)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="auth_capable-3F-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 320</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">auth_capable?</span>(<span class="ruby-identifier">type</span>)
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">nil</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@capabilities</span>
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">false</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@capabilities</span>[<span class="ruby-string">&#39;AUTH&#39;</span>]
  <span class="ruby-ivar">@capabilities</span>[<span class="ruby-string">&#39;AUTH&#39;</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">type</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-auth_method" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">auth_method</span><span
                                class="method-args">(type)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="auth_method-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 880</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">auth_method</span>(<span class="ruby-identifier">type</span>)
  <span class="ruby-node">&quot;auth_#{type.to_s.downcase}&quot;</span>.<span class="ruby-identifier">intern</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-base64_encode" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">base64_encode</span><span
                                class="method-args">(str)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="base64_encode-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 893</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">base64_encode</span>(<span class="ruby-identifier">str</span>)
  <span class="ruby-comment"># expects &quot;str&quot; may not become too long</span>
  [<span class="ruby-identifier">str</span>].<span class="ruby-identifier">pack</span>(<span class="ruby-string">&#39;m0&#39;</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-check_auth_args" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">check_auth_args</span><span
                                class="method-args">(user, secret, authtype = DEFAULT_AUTH_TYPE)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="check_auth_args-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 884</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">check_auth_args</span>(<span class="ruby-identifier">user</span>, <span class="ruby-identifier">secret</span>, <span class="ruby-identifier">authtype</span> = <span class="ruby-constant">DEFAULT_AUTH_TYPE</span>)
  <span class="ruby-keyword">unless</span> <span class="ruby-identifier">user</span>
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-string">&#39;SMTP-AUTH requested but missing user name&#39;</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">unless</span> <span class="ruby-identifier">secret</span>
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-string">&#39;SMTP-AUTH requested but missing secret phrase&#39;</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-check_auth_continue" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">check_auth_continue</span><span
                                class="method-args">(res)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="check_auth_continue-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 1092</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">check_auth_continue</span>(<span class="ruby-identifier">res</span>)
  <span class="ruby-keyword">unless</span> <span class="ruby-identifier">res</span>.<span class="ruby-identifier">continue?</span>
    <span class="ruby-identifier">raise</span> <span class="ruby-identifier">res</span>.<span class="ruby-identifier">exception_class</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">res</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-check_auth_method" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">check_auth_method</span><span
                                class="method-args">(type)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="check_auth_method-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 874</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">check_auth_method</span>(<span class="ruby-identifier">type</span>)
  <span class="ruby-keyword">unless</span> <span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">auth_method</span>(<span class="ruby-identifier">type</span>), <span class="ruby-keyword">true</span>)
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">&quot;wrong authentication type #{type}&quot;</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-check_auth_response" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">check_auth_response</span><span
                                class="method-args">(res)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="check_auth_response-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 1086</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">check_auth_response</span>(<span class="ruby-identifier">res</span>)
  <span class="ruby-keyword">unless</span> <span class="ruby-identifier">res</span>.<span class="ruby-identifier">success?</span>
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">SMTPAuthenticationError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">res</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-check_continue" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">check_continue</span><span
                                class="method-args">(res)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="check_continue-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 1080</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">check_continue</span>(<span class="ruby-identifier">res</span>)
  <span class="ruby-keyword">unless</span> <span class="ruby-identifier">res</span>.<span class="ruby-identifier">continue?</span>
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">SMTPUnknownError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">res</span>, <span class="ruby-value">message:</span> <span class="ruby-node">&quot;could not get 3xx (#{res.status}: #{res.string})&quot;</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-check_response" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">check_response</span><span
                                class="method-args">(res)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="check_response-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 1074</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">check_response</span>(<span class="ruby-identifier">res</span>)
  <span class="ruby-keyword">unless</span> <span class="ruby-identifier">res</span>.<span class="ruby-identifier">success?</span>
    <span class="ruby-identifier">raise</span> <span class="ruby-identifier">res</span>.<span class="ruby-identifier">exception_class</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">res</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-cram_md5_response" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">cram_md5_response</span><span
                                class="method-args">(secret, challenge)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>CRAM-MD5: [RFC2195]</p>

                              <div class="method-source-code" id="cram_md5_response-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 902</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">cram_md5_response</span>(<span class="ruby-identifier">secret</span>, <span class="ruby-identifier">challenge</span>)
  <span class="ruby-identifier">tmp</span> = <span class="ruby-identifier">digest_class</span><span class="ruby-operator">::</span><span class="ruby-constant">MD5</span>.<span class="ruby-identifier">digest</span>(<span class="ruby-identifier">cram_secret</span>(<span class="ruby-identifier">secret</span>, <span class="ruby-constant">IMASK</span>) <span class="ruby-operator">+</span> <span class="ruby-identifier">challenge</span>)
  <span class="ruby-identifier">digest_class</span><span class="ruby-operator">::</span><span class="ruby-constant">MD5</span>.<span class="ruby-identifier">hexdigest</span>(<span class="ruby-identifier">cram_secret</span>(<span class="ruby-identifier">secret</span>, <span class="ruby-constant">OMASK</span>) <span class="ruby-operator">+</span> <span class="ruby-identifier">tmp</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-cram_secret" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">cram_secret</span><span
                                class="method-args">(secret, mask)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="cram_secret-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 909</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">cram_secret</span>(<span class="ruby-identifier">secret</span>, <span class="ruby-identifier">mask</span>)
  <span class="ruby-identifier">secret</span> = <span class="ruby-identifier">digest_class</span><span class="ruby-operator">::</span><span class="ruby-constant">MD5</span>.<span class="ruby-identifier">digest</span>(<span class="ruby-identifier">secret</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">secret</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-constant">CRAM_BUFSIZE</span>
  <span class="ruby-identifier">buf</span> = <span class="ruby-identifier">secret</span>.<span class="ruby-identifier">ljust</span>(<span class="ruby-constant">CRAM_BUFSIZE</span>, <span class="ruby-string">&quot;\0&quot;</span>)
  <span class="ruby-value">0</span>.<span class="ruby-identifier">upto</span>(<span class="ruby-identifier">buf</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">buf</span>[<span class="ruby-identifier">i</span>] = (<span class="ruby-identifier">buf</span>[<span class="ruby-identifier">i</span>].<span class="ruby-identifier">ord</span> <span class="ruby-operator">^</span> <span class="ruby-identifier">mask</span>).<span class="ruby-identifier">chr</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">buf</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-critical" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">critical</span><span
                                class="method-args">() { || ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="critical-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 1064</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">critical</span>
  <span class="ruby-keyword">return</span> <span class="ruby-constant">Response</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-string">&#39;200 dummy reply code&#39;</span>) <span class="ruby-keyword">if</span> <span class="ruby-ivar">@error_occurred</span>
  <span class="ruby-keyword">begin</span>
    <span class="ruby-keyword">return</span> <span class="ruby-keyword">yield</span>()
  <span class="ruby-keyword">rescue</span> <span class="ruby-constant">Exception</span>
    <span class="ruby-ivar">@error_occurred</span> = <span class="ruby-keyword">true</span>
    <span class="ruby-identifier">raise</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-digest_class" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">digest_class</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="digest_class-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 631</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">digest_class</span>
  <span class="ruby-ivar">@digest_class</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword">if</span> <span class="ruby-keyword">defined?</span>(<span class="ruby-constant">OpenSSL</span><span class="ruby-operator">::</span><span class="ruby-constant">Digest</span>)
                      <span class="ruby-constant">OpenSSL</span><span class="ruby-operator">::</span><span class="ruby-constant">Digest</span>
                    <span class="ruby-keyword">elsif</span> <span class="ruby-keyword">defined?</span>(<span class="ruby-operator">::</span><span class="ruby-constant">Digest</span>)
                      <span class="ruby-operator">::</span><span class="ruby-constant">Digest</span>
                    <span class="ruby-keyword">else</span>
                      <span class="ruby-identifier">raise</span> <span class="ruby-string">&#39;&quot;openssl&quot; or &quot;digest&quot; library is required&#39;</span>
                    <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-do_finish" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">do_finish</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="do_finish-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 714</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">do_finish</span>
  <span class="ruby-identifier">quit</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@socket</span> <span class="ruby-keyword">and</span> <span class="ruby-keyword">not</span> <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">closed?</span> <span class="ruby-keyword">and</span> <span class="ruby-keyword">not</span> <span class="ruby-ivar">@error_occurred</span>
<span class="ruby-keyword">ensure</span>
  <span class="ruby-ivar">@started</span> = <span class="ruby-keyword">false</span>
  <span class="ruby-ivar">@error_occurred</span> = <span class="ruby-keyword">false</span>
  <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@socket</span>
  <span class="ruby-ivar">@socket</span> = <span class="ruby-keyword">nil</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-do_helo" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">do_helo</span><span
                                class="method-args">(helo_domain)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="do_helo-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 702</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">do_helo</span>(<span class="ruby-identifier">helo_domain</span>)
  <span class="ruby-identifier">res</span> = <span class="ruby-ivar">@esmtp</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">ehlo</span>(<span class="ruby-identifier">helo_domain</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">helo</span>(<span class="ruby-identifier">helo_domain</span>)
  <span class="ruby-ivar">@capabilities</span> = <span class="ruby-identifier">res</span>.<span class="ruby-identifier">capabilities</span>
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">SMTPError</span>
  <span class="ruby-keyword">if</span> <span class="ruby-ivar">@esmtp</span>
    <span class="ruby-ivar">@esmtp</span> = <span class="ruby-keyword">false</span>
    <span class="ruby-ivar">@error_occurred</span> = <span class="ruby-keyword">false</span>
    <span class="ruby-keyword">retry</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">raise</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-do_start" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">do_start</span><span
                                class="method-args">(helo_domain, user, secret, authtype)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="do_start-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 650</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">do_start</span>(<span class="ruby-identifier">helo_domain</span>, <span class="ruby-identifier">user</span>, <span class="ruby-identifier">secret</span>, <span class="ruby-identifier">authtype</span>)
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">IOError</span>, <span class="ruby-string">&#39;SMTP session already started&#39;</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@started</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">user</span> <span class="ruby-keyword">or</span> <span class="ruby-identifier">secret</span>
    <span class="ruby-identifier">check_auth_method</span>(<span class="ruby-identifier">authtype</span> <span class="ruby-operator">||</span> <span class="ruby-constant">DEFAULT_AUTH_TYPE</span>)
    <span class="ruby-identifier">check_auth_args</span> <span class="ruby-identifier">user</span>, <span class="ruby-identifier">secret</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">s</span> = <span class="ruby-identifier">tcp_socket</span>(<span class="ruby-ivar">@address</span>, <span class="ruby-ivar">@port</span>)
  <span class="ruby-identifier">logging</span> <span class="ruby-node">&quot;Connection opened: #{@address}:#{@port}&quot;</span>
  <span class="ruby-ivar">@socket</span> = <span class="ruby-identifier">new_internet_message_io</span>(<span class="ruby-identifier">tls?</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">tlsconnect</span>(<span class="ruby-identifier">s</span>, <span class="ruby-ivar">@ssl_context_tls</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">s</span>)
  <span class="ruby-identifier">check_response</span> <span class="ruby-identifier">critical</span> { <span class="ruby-identifier">recv_response</span>() }
  <span class="ruby-identifier">do_helo</span> <span class="ruby-identifier">helo_domain</span>
  <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span> <span class="ruby-identifier">tls?</span> <span class="ruby-keyword">and</span> (<span class="ruby-identifier">starttls_always?</span> <span class="ruby-keyword">or</span> (<span class="ruby-identifier">capable_starttls?</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">starttls_auto?</span>))
    <span class="ruby-keyword">unless</span> <span class="ruby-identifier">capable_starttls?</span>
      <span class="ruby-identifier">raise</span> <span class="ruby-constant">SMTPUnsupportedCommand</span>, <span class="ruby-string">&quot;STARTTLS is not supported on this server&quot;</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">starttls</span>
    <span class="ruby-ivar">@socket</span> = <span class="ruby-identifier">new_internet_message_io</span>(<span class="ruby-identifier">tlsconnect</span>(<span class="ruby-identifier">s</span>, <span class="ruby-ivar">@ssl_context_starttls</span>))
    <span class="ruby-comment"># helo response may be different after STARTTLS</span>
    <span class="ruby-identifier">do_helo</span> <span class="ruby-identifier">helo_domain</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">authenticate</span> <span class="ruby-identifier">user</span>, <span class="ruby-identifier">secret</span>, (<span class="ruby-identifier">authtype</span> <span class="ruby-operator">||</span> <span class="ruby-constant">DEFAULT_AUTH_TYPE</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">user</span>
  <span class="ruby-ivar">@started</span> = <span class="ruby-keyword">true</span>
<span class="ruby-keyword">ensure</span>
  <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@started</span>
    <span class="ruby-comment"># authentication failed, cancel connection.</span>
    <span class="ruby-identifier">s</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">s</span>
    <span class="ruby-ivar">@socket</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-get_response" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">get_response</span><span
                                class="method-args">(reqline)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="get_response-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 1048</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_response</span>(<span class="ruby-identifier">reqline</span>)
  <span class="ruby-identifier">validate_line</span> <span class="ruby-identifier">reqline</span>
  <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">writeline</span> <span class="ruby-identifier">reqline</span>
  <span class="ruby-identifier">recv_response</span>()
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-getok" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">getok</span><span
                                class="method-args">(reqline)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="getok-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 1038</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">getok</span>(<span class="ruby-identifier">reqline</span>)
  <span class="ruby-identifier">validate_line</span> <span class="ruby-identifier">reqline</span>
  <span class="ruby-identifier">res</span> = <span class="ruby-identifier">critical</span> {
    <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">writeline</span> <span class="ruby-identifier">reqline</span>
    <span class="ruby-identifier">recv_response</span>()
  }
  <span class="ruby-identifier">check_response</span> <span class="ruby-identifier">res</span>
  <span class="ruby-identifier">res</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-logging" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">logging</span><span
                                class="method-args">(msg)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="logging-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 1177</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">logging</span>(<span class="ruby-identifier">msg</span>)
  <span class="ruby-ivar">@debug_output</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">msg</span> <span class="ruby-operator">+</span> <span class="ruby-string">&quot;\n&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@debug_output</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-new_internet_message_io" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">new_internet_message_io</span><span
                                class="method-args">(s)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="new_internet_message_io-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 697</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">new_internet_message_io</span>(<span class="ruby-identifier">s</span>)
  <span class="ruby-constant">InternetMessageIO</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">s</span>, <span class="ruby-value">read_timeout:</span> <span class="ruby-ivar">@read_timeout</span>,
                        <span class="ruby-value">debug_output:</span> <span class="ruby-ivar">@debug_output</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-recv_response" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">recv_response</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="recv_response-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 1054</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">recv_response</span>
  <span class="ruby-identifier">buf</span> = <span class="ruby-string">&#39;&#39;</span>.<span class="ruby-identifier">dup</span>
  <span class="ruby-keyword">while</span> <span class="ruby-keyword">true</span>
    <span class="ruby-identifier">line</span> = <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">readline</span>
    <span class="ruby-identifier">buf</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">line</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot;\n&quot;</span>
    <span class="ruby-keyword">break</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">line</span>[<span class="ruby-value">3</span>,<span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-string">&#39;-&#39;</span>   <span class="ruby-comment"># &quot;210-PIPELINING&quot;</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-constant">Response</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">buf</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-ssl_socket" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">ssl_socket</span><span
                                class="method-args">(socket, context)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="ssl_socket-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 680</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">ssl_socket</span>(<span class="ruby-identifier">socket</span>, <span class="ruby-identifier">context</span>)
  <span class="ruby-constant">OpenSSL</span><span class="ruby-operator">::</span><span class="ruby-constant">SSL</span><span class="ruby-operator">::</span><span class="ruby-constant">SSLSocket</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">socket</span>, <span class="ruby-identifier">context</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-tcp_socket" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">tcp_socket</span><span
                                class="method-args">(address, port)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="tcp_socket-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 641</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">tcp_socket</span>(<span class="ruby-identifier">address</span>, <span class="ruby-identifier">port</span>)
  <span class="ruby-keyword">begin</span>
    <span class="ruby-constant">Socket</span>.<span class="ruby-identifier">tcp</span> <span class="ruby-identifier">address</span>, <span class="ruby-identifier">port</span>, <span class="ruby-keyword">nil</span>, <span class="ruby-keyword">nil</span>, <span class="ruby-value">connect_timeout:</span> <span class="ruby-ivar">@open_timeout</span>
  <span class="ruby-keyword">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ETIMEDOUT</span> <span class="ruby-comment">#raise Net:OpenTimeout instead for compatibility with previous versions</span>
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">OpenTimeout</span>, <span class="ruby-string">&quot;Timeout to open TCP connection to &quot;</span>\
      <span class="ruby-node">&quot;#{address}:#{port} (exceeds #{@open_timeout} seconds)&quot;</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-tlsconnect" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">tlsconnect</span><span
                                class="method-args">(s, context)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="tlsconnect-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 684</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">tlsconnect</span>(<span class="ruby-identifier">s</span>, <span class="ruby-identifier">context</span>)
  <span class="ruby-identifier">verified</span> = <span class="ruby-keyword">false</span>
  <span class="ruby-identifier">s</span> = <span class="ruby-identifier">ssl_socket</span>(<span class="ruby-identifier">s</span>, <span class="ruby-identifier">context</span>)
  <span class="ruby-identifier">logging</span> <span class="ruby-string">&quot;TLS connection started&quot;</span>
  <span class="ruby-identifier">s</span>.<span class="ruby-identifier">sync_close</span> = <span class="ruby-keyword">true</span>
  <span class="ruby-identifier">s</span>.<span class="ruby-identifier">hostname</span> = <span class="ruby-ivar">@tls_hostname</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@address</span>
  <span class="ruby-identifier">ssl_socket_connect</span>(<span class="ruby-identifier">s</span>, <span class="ruby-ivar">@open_timeout</span>)
  <span class="ruby-identifier">verified</span> = <span class="ruby-keyword">true</span>
  <span class="ruby-identifier">s</span>
<span class="ruby-keyword">ensure</span>
  <span class="ruby-identifier">s</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">verified</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-validate_line" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">validate_line</span><span
                                class="method-args">(line)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="validate_line-source">
            <pre><span class="ruby-comment"># File net-smtp-0.3.3/lib/net/smtp.rb, line 1031</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">validate_line</span>(<span class="ruby-identifier">line</span>)
  <span class="ruby-comment"># A bare CR or LF is not allowed in RFC5321.</span>
  <span class="ruby-keyword">if</span> <span class="ruby-regexp">/[\r\n]/</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">line</span>
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-string">&quot;A line must not contain CR or LF&quot;</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is provided by <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>. </p><p><a href="https://jamesbritt.bandcamp.com/">Hack your world.  Feed your head.  Live curious</a>.</p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

